﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Runtime.CompilerServices;

using ConstructionBidOnline.DAL;
using ConstructionBidOnline.DAL.dsContractsTableAdapters;
using ConstructionBidOnline.Common;

namespace ConstructionBidOnline.Biz
{
    /// <summary>
    /// Job History Business Object
    /// </summary>

    public class Contracts : BOBase
    {
        #region Construction / Disposal

        /// <summary>
        /// Default constructor.
        /// </summary>
        protected Contracts() { }

        #endregion

        #region Public Properties

        #region Instance Properties



        /// <summary>
        /// ContractID.
        /// </summary>
        public string ContractID
        {
            get { return _contractID; }
            set
            {
                if (_contractID != value)
                {
                    if (OnPropertyChanging("ContractID", _contractID, value))
                    {
                        string oldValue = _contractID;
                        _contractID = value;
                        OnPropertyChanged("ContractID", oldValue, value);
                    }
                }
            }
        }  private string _contractID = null;





        /// <summary>
        /// JobID.
        /// </summary>
        public string JobID
        {
            get { return _jobID; }
            set
            {
                if (_jobID != value)
                {
                    if (OnPropertyChanging("JobID", _jobID, value))
                    {
                        string oldValue = _jobID;
                        _jobID = value;
                        OnPropertyChanged("JobID", oldValue, value);
                    }
                }
            }
        }  private string _jobID = null;


        /// <summary>
        /// BidID.
        /// </summary>
        public int BidID
        {
            get { return _bidID; }
            set
            {
                if (_bidID != value)
                {
                    if (OnPropertyChanging("BidID", _bidID, value))
                    {
                        int oldValue = _bidID;
                        _bidID = value;
                        OnPropertyChanged("BidID", oldValue, value);
                    }
                }
            }
        }  private int _bidID = -1;


        /// <summary>
        /// ContractStatus.
        /// </summary>
        public string ContractStatus
        {
            get { return _contractStatus; }
            set
            {
                if (_contractStatus != value)
                {
                    if (OnPropertyChanging("ContractStatus", _contractStatus, value))
                    {
                        string oldValue = _contractStatus;
                        _contractStatus = value;
                        OnPropertyChanged("ContractStatus", oldValue, value);
                    }
                }
            }
        }  private string _contractStatus = null;



        /// <summary>
        /// Date/time at which the Contracts was created.
        /// </summary>
        public DateTime? StartingDate
        {
            get { return _startingDate; }
            set
            {
                if (_startingDate != value)
                {
                    if (OnPropertyChanging("StartingDate", _startingDate, value))
                    {
                        DateTime? oldValue = _startingDate;
                        _startingDate = value;
                        OnPropertyChanged("StartingDate", oldValue, value);
                    }
                }
            }
        }  private DateTime? _startingDate = null;


        /// <summary>
        /// Date/time at which the Contracts will end.
        /// </summary>
        public DateTime? EndingDate
        {
            get { return _endingDate; }
            set
            {
                if (_endingDate != value)
                {
                    if (OnPropertyChanging("EndingDate", _endingDate, value))
                    {
                        DateTime? oldValue = _endingDate;
                        _endingDate = value;
                        OnPropertyChanged("EndingDate", oldValue, value);
                    }
                }
            }
        }  private DateTime? _endingDate = null;



        /// <summary>
        /// IsContractFeesGiven to check weather the contractor has paid his contract fees.
        /// </summary>
        public bool IsContractFeesGiven
        {
            get { return _isContractFeesGiven; }
            set
            {
                if (_isContractFeesGiven != value)
                {
                    if (OnPropertyChanging("IsContractFeesGiven", _isContractFeesGiven, value))
                    {
                        bool oldValue = _isContractFeesGiven;
                        _isContractFeesGiven = value;
                        OnPropertyChanged("IsContractFeesGiven", oldValue, value);
                    }
                }
            }
        }  private bool _isContractFeesGiven = false;


        /// <summary>
        /// IsBuyerRequestedtoClose to check weather the buyer has requested to closer the project.
        /// </summary>
        public bool IsBuyerRequestedtoClose
        {
            get { return _isBuyerRequestedtoClose; }
            set
            {
                if (_isBuyerRequestedtoClose != value)
                {
                    if (OnPropertyChanging("IsBuyerRequestedtoClose", _isBuyerRequestedtoClose, value))
                    {
                        bool oldValue = _isBuyerRequestedtoClose;
                        _isBuyerRequestedtoClose = value;
                        OnPropertyChanged("IsBuyerRequestedtoClose", oldValue, value);
                    }
                }
            }
        }  private bool _isBuyerRequestedtoClose = false;


        /// <summary>
        /// IsContractorRequesttoClose to check weather the buyer has requested to closer the project.
        /// </summary>
        public bool IsContractorRequesttoClose
        {
            get { return _isContractorRequesttoClose; }
            set
            {
                if (_isContractorRequesttoClose != value)
                {
                    if (OnPropertyChanging("IsContractorRequesttoClose", _isContractorRequesttoClose, value))
                    {
                        bool oldValue = _isContractorRequesttoClose;
                        _isContractorRequesttoClose = value;
                        OnPropertyChanged("IsContractorRequesttoClose", oldValue, value);
                    }
                }
            }
        }  private bool _isContractorRequesttoClose = false;


        /// <summary>
        /// HasBuyerAcceptedEnding.
        /// </summary>
        public bool HasBuyerAcceptedEnding
        {
            get { return _hasBuyerAcceptedEnding; }
            set
            {
                if (_hasBuyerAcceptedEnding != value)
                {
                    if (OnPropertyChanging("HasBuyerAcceptedEnding", _hasBuyerAcceptedEnding, value))
                    {
                        bool oldValue = _hasBuyerAcceptedEnding;
                        _hasBuyerAcceptedEnding = value;
                        OnPropertyChanged("HasBuyerAcceptedEnding", oldValue, value);
                    }
                }
            }
        }  private bool _hasBuyerAcceptedEnding = false;

        /// <summary>
        /// HasContractorAcceptedEnding.
        /// </summary>
        public bool HasContractorAcceptedEnding
        {
            get { return _hasContractorAcceptedEnding; }
            set
            {
                if (_hasContractorAcceptedEnding != value)
                {
                    if (OnPropertyChanging("HasContractorAcceptedEnding", _hasContractorAcceptedEnding, value))
                    {
                        bool oldValue = _hasContractorAcceptedEnding;
                        _hasContractorAcceptedEnding = value;
                        OnPropertyChanged("HasContractorAcceptedEnding", oldValue, value);
                    }
                }
            }
        }  private bool _hasContractorAcceptedEnding = false;


        /// <summary>
        /// IsBuyerFeedBackGiven to check weather the buyer's feedback is given by the contractor.
        /// </summary>
        public bool IsBuyerFeedBackGiven
        {
            get { return _isBuyerFeedBackGiven; }
            set
            {
                if (_isBuyerFeedBackGiven != value)
                {
                    if (OnPropertyChanging("IsBuyerFeedBackGiven", _isBuyerFeedBackGiven, value))
                    {
                        bool oldValue = _isBuyerFeedBackGiven;
                        _isBuyerFeedBackGiven = value;
                        OnPropertyChanged("IsBuyerFeedBackGiven", oldValue, value);
                    }
                }
            }
        }  private bool _isBuyerFeedBackGiven = false;


        /// <summary>
        /// BuyerFeedBackCount.
        /// </summary>
        public int BuyerFeedBackCount
        {
            get { return _buyerFeedBackCount; }
            set
            {
                if (_buyerFeedBackCount != value)
                {
                    if (OnPropertyChanging("BuyerFeedBackCount", _buyerFeedBackCount, value))
                    {
                        int oldValue = _buyerFeedBackCount;
                        _buyerFeedBackCount = value;
                        OnPropertyChanged("BuyerFeedBackCount", oldValue, value);
                    }
                }
            }
        }  private int _buyerFeedBackCount = 0;


        /// <summary>
        /// IsBuyerFeedBackPrivate buyer can make his feedback private.
        /// </summary>
        public bool IsBuyerFeedBackPrivate
        {
            get { return _isBuyerFeedBackPrivate; }
            set
            {
                if (_isBuyerFeedBackPrivate != value)
                {
                    if (OnPropertyChanging("IsBuyerFeedBackPrivate", _isBuyerFeedBackPrivate, value))
                    {
                        bool oldValue = _isBuyerFeedBackPrivate;
                        _isBuyerFeedBackPrivate = value;
                        OnPropertyChanged("IsBuyerFeedBackPrivate", oldValue, value);
                    }
                }
            }
        }  private bool _isBuyerFeedBackPrivate = false;



        /// <summary>
        /// BFFC.
        /// </summary>
        public int BFFC
        {
            get { return _bffc; }
            set
            {
                if (_bffc != value)
                {
                    if (OnPropertyChanging("BFFC", _bffc, value))
                    {
                        int oldValue = _bffc;
                        _bffc = value;
                        OnPropertyChanged("BFFC", oldValue, value);
                    }
                }
            }
        }  private int _bffc = -1;


        /// <summary>
        /// BFFS.
        /// </summary>
        public int BFFS
        {
            get { return _bffs; }
            set
            {
                if (_bffs != value)
                {
                    if (OnPropertyChanging("BFFS", _bffs, value))
                    {
                        int oldValue = _bffs;
                        _bffs = value;
                        OnPropertyChanged("BFFS", oldValue, value);
                    }
                }
            }
        }  private int _bffs = -1;


        /// <summary>
        /// BFFV.
        /// </summary>
        public int BFFV
        {
            get { return _bffv; }
            set
            {
                if (_bffv != value)
                {
                    if (OnPropertyChanging("BFFV", _bffv, value))
                    {
                        int oldValue = _bffv;
                        _bffv = value;
                        OnPropertyChanged("BFFV", oldValue, value);
                    }
                }
            }
        }  private int _bffv = -1;


        /// <summary>
        /// BFFP.
        /// </summary>
        public int BFFP
        {
            get { return _bffp; }
            set
            {
                if (_bffp != value)
                {
                    if (OnPropertyChanging("BFFP", _bffp, value))
                    {
                        int oldValue = _bffp;
                        _bffp = value;
                        OnPropertyChanged("BFFP", oldValue, value);
                    }
                }
            }
        }  private int _bffp = -1;


        /// <summary>
        /// BFFPR.
        /// </summary>
        public int BFFPR
        {
            get { return _bffpr; }
            set
            {
                if (_bffpr != value)
                {
                    if (OnPropertyChanging("BFFPR", _bffpr, value))
                    {
                        int oldValue = _bffpr;
                        _bffpr = value;
                        OnPropertyChanged("BFFPR", oldValue, value);
                    }
                }
            }
        }  private int _bffpr = -1;



        /// <summary>
        /// BFFCQ.
        /// </summary>
        public int BFFCQ
        {
            get { return _bffcq; }
            set
            {
                if (_bffcq != value)
                {
                    if (OnPropertyChanging("BFFCQ", _bffcq, value))
                    {
                        int oldValue = _bffcq;
                        _bffcq = value;
                        OnPropertyChanged("BFFCQ", oldValue, value);
                    }
                }
            }
        }  private int _bffcq = -1;


        /// <summary>
        /// BFFJC.
        /// </summary>
        public int BFFJC
        {
            get { return _bffjc; }
            set
            {
                if (_bffjc != value)
                {
                    if (OnPropertyChanging("BFFJC", _bffjc, value))
                    {
                        int oldValue = _bffjc;
                        _bffjc = value;
                        OnPropertyChanged("BFFJC", oldValue, value);
                    }
                }
            }
        }  private int _bffjc = -1;


        /// <summary>
        /// BFFAB.
        /// </summary>
        public int BFFAB
        {
            get { return _bffab; }
            set
            {
                if (_bffab != value)
                {
                    if (OnPropertyChanging("BFFAB", _bffab, value))
                    {
                        int oldValue = _bffab;
                        _bffab = value;
                        OnPropertyChanged("BFFAB", oldValue, value);
                    }
                }
            }
        }  private int _bffab = -1;


        /// <summary>
        /// BFComment.
        /// </summary>
        public string BFComment
        {
            get { return _bfComment; }
            set
            {
                if (_bfComment != value)
                {
                    if (OnPropertyChanging("BFComment", _bfComment, value))
                    {
                        string oldValue = _bfComment;
                        _bfComment = value;
                        OnPropertyChanged("BFComment", oldValue, value);
                    }
                }
            }
        }  private string _bfComment = null;


        /// <summary>
        /// IsContractorFeedBackGiven to check weather the contractor's feedback is given by the buyer.
        /// </summary>
        public bool IsContractorFeedBackGiven
        {
            get { return _isContractorFeedBackGiven; }
            set
            {
                if (_isContractorFeedBackGiven != value)
                {
                    if (OnPropertyChanging("IsContractorFeedBackGiven", _isContractorFeedBackGiven, value))
                    {
                        bool oldValue = _isContractorFeedBackGiven;
                        _isContractorFeedBackGiven = value;
                        OnPropertyChanged("IsContractorFeedBackGiven", oldValue, value);
                    }
                }
            }
        }  private bool _isContractorFeedBackGiven = false;


        


        /// <summary>
        /// ContractorFeedBackCount.
        /// </summary>
        public int ContractorFeedBackCount
        {
            get { return _contractorFeedBackCount; }
            set
            {
                if (_contractorFeedBackCount != value)
                {
                    if (OnPropertyChanging("ContractorFeedBackCount", _contractorFeedBackCount, value))
                    {
                        int oldValue = _contractorFeedBackCount;
                        _contractorFeedBackCount = value;
                        OnPropertyChanged("ContractorFeedBackCount", oldValue, value);
                    }
                }
            }
        }  private int _contractorFeedBackCount = 0;


        


        /// <summary>
        /// IsContractorFeedBackPrivate Contractor can make his feedback private.
        /// </summary>
        public bool IsContractorFeedBackPrivate
        {
            get { return _isContractorFeedBackPrivate; }
            set
            {
                if (_isContractorFeedBackPrivate != value)
                {
                    if (OnPropertyChanging("IsContractorFeedBackPrivate", _isContractorFeedBackPrivate, value))
                    {
                        bool oldValue = _isContractorFeedBackPrivate;
                        _isContractorFeedBackPrivate = value;
                        OnPropertyChanged("IsContractorFeedBackPrivate", oldValue, value);
                    }
                }
            }
        }  private bool _isContractorFeedBackPrivate = false;


        


        /// <summary>
        /// CFFC.
        /// </summary>
        public int CFFC
        {
            get { return _cffc; }
            set
            {
                if (_cffc != value)
                {
                    if (OnPropertyChanging("CFFC", _cffc, value))
                    {
                        int oldValue = _cffc;
                        _cffc = value;
                        OnPropertyChanged("CFFC", oldValue, value);
                    }
                }
            }
        }  private int _cffc = -1;


        /// <summary>
        /// CFFS.
        /// </summary>
        public int CFFS
        {
            get { return _cffs; }
            set
            {
                if (_cffs != value)
                {
                    if (OnPropertyChanging("CFFS", _cffs, value))
                    {
                        int oldValue = _cffs;
                        _cffs = value;
                        OnPropertyChanged("CFFS", oldValue, value);
                    }
                }
            }
        }  private int _cffs = -1;


        /// <summary>
        /// CFFV.
        /// </summary>
        public int CFFV
        {
            get { return _cffv; }
            set
            {
                if (_cffv != value)
                {
                    if (OnPropertyChanging("CFFV", _cffv, value))
                    {
                        int oldValue = _cffv;
                        _cffv = value;
                        OnPropertyChanged("CFFV", oldValue, value);
                    }
                }
            }
        }  private int _cffv = -1;


        /// <summary>
        /// CFFP.
        /// </summary>
        public int CFFP
        {
            get { return _cffp; }
            set
            {
                if (_cffp != value)
                {
                    if (OnPropertyChanging("CFFP", _cffp, value))
                    {
                        int oldValue = _cffp;
                        _cffp = value;
                        OnPropertyChanged("CFFP", oldValue, value);
                    }
                }
            }
        }  private int _cffp = -1;


        /// <summary>
        /// CFFPR.
        /// </summary>
        public int CFFPR
        {
            get { return _cffpr; }
            set
            {
                if (_cffpr != value)
                {
                    if (OnPropertyChanging("CFFPR", _cffpr, value))
                    {
                        int oldValue = _cffpr;
                        _cffpr = value;
                        OnPropertyChanged("CFFPR", oldValue, value);
                    }
                }
            }
        }  private int _cffpr = -1;



        /// <summary>
        /// CFFCQ.
        /// </summary>
        public int CFFCQ
        {
            get { return _cffcq; }
            set
            {
                if (_cffcq != value)
                {
                    if (OnPropertyChanging("CFFCQ", _cffcq, value))
                    {
                        int oldValue = _cffcq;
                        _cffcq = value;
                        OnPropertyChanged("CFFCQ", oldValue, value);
                    }
                }
            }
        }  private int _cffcq = -1;


        /// <summary>
        /// CFFJC.
        /// </summary>
        public int CFFJC
        {
            get { return _cffjc; }
            set
            {
                if (_cffjc != value)
                {
                    if (OnPropertyChanging("CFFJC", _cffjc, value))
                    {
                        int oldValue = _cffjc;
                        _cffjc = value;
                        OnPropertyChanged("CFFJC", oldValue, value);
                    }
                }
            }
        }  private int _cffjc = -1;


        /// <summary>
        /// CFFAB.
        /// </summary>
        public int CFFAB
        {
            get { return _cffab; }
            set
            {
                if (_cffab != value)
                {
                    if (OnPropertyChanging("CFFAB", _cffab, value))
                    {
                        int oldValue = _cffab;
                        _cffab = value;
                        OnPropertyChanged("CFFAB", oldValue, value);
                    }
                }
            }
        }  private int _cffab = -1;


        /// <summary>
        /// CFComment.
        /// </summary>
        public string CFComment
        {
            get { return _cfComment; }
            set
            {
                if (_cfComment != value)
                {
                    if (OnPropertyChanging("CFComment", _cfComment, value))
                    {
                        string oldValue = _cfComment;
                        _cfComment = value;
                        OnPropertyChanged("CFComment", oldValue, value);
                    }
                }
            }
        }  private string _cfComment = null;



        /// <summary>
        /// IsConsultantFeedBackGiven to check weather the Consultant's feedback is given by the buyer.
        /// </summary>
        public bool IsConsultantFeedBackGiven
        {
            get { return _isConsultantFeedBackGiven; }
            set
            {
                if (_isConsultantFeedBackGiven != value)
                {
                    if (OnPropertyChanging("IsConsultantFeedBackGiven", _isConsultantFeedBackGiven, value))
                    {
                        bool oldValue = _isConsultantFeedBackGiven;
                        _isConsultantFeedBackGiven = value;
                        OnPropertyChanged("IsConsultantFeedBackGiven", oldValue, value);
                    }
                }
            }
        }  private bool _isConsultantFeedBackGiven = false;





        /// <summary>
        /// ConsultantFeedBackCount.
        /// </summary>
        public int ConsultantFeedBackCount
        {
            get { return _consultantFeedBackCount; }
            set
            {
                if (_consultantFeedBackCount != value)
                {
                    if (OnPropertyChanging("ConsultantFeedBackCount", _consultantFeedBackCount, value))
                    {
                        int oldValue = _consultantFeedBackCount;
                        _consultantFeedBackCount = value;
                        OnPropertyChanged("ConsultantFeedBackCount", oldValue, value);
                    }
                }
            }
        }  private int _consultantFeedBackCount = 0;





        /// <summary>
        /// IsConsultantFeedBackPrivate Consultant can make his feedback private.
        /// </summary>
        public bool IsConsultantFeedBackPrivate
        {
            get { return _isConsultantFeedBackPrivate; }
            set
            {
                if (_isConsultantFeedBackPrivate != value)
                {
                    if (OnPropertyChanging("IsConsultantFeedBackPrivate", _isConsultantFeedBackPrivate, value))
                    {
                        bool oldValue = _isConsultantFeedBackPrivate;
                        _isConsultantFeedBackPrivate = value;
                        OnPropertyChanged("IsConsultantFeedBackPrivate", oldValue, value);
                    }
                }
            }
        }  private bool _isConsultantFeedBackPrivate = false;





        /// <summary>
        /// CCFFC.
        /// </summary>
        public int CCFFC
        {
            get { return _ccffc; }
            set
            {
                if (_ccffc != value)
                {
                    if (OnPropertyChanging("CCFFC", _ccffc, value))
                    {
                        int oldValue = _ccffc;
                        _ccffc = value;
                        OnPropertyChanged("CCFFC", oldValue, value);
                    }
                }
            }
        }  private int _ccffc = -1;


        /// <summary>
        /// CCFFS.
        /// </summary>
        public int CCFFS
        {
            get { return _ccffs; }
            set
            {
                if (_ccffs != value)
                {
                    if (OnPropertyChanging("CCFFS", _ccffs, value))
                    {
                        int oldValue = _ccffs;
                        _ccffs = value;
                        OnPropertyChanged("CCFFS", oldValue, value);
                    }
                }
            }
        }  private int _ccffs = -1;


        /// <summary>
        /// CCFFV.
        /// </summary>
        public int CCFFV
        {
            get { return _ccffv; }
            set
            {
                if (_ccffv != value)
                {
                    if (OnPropertyChanging("CCFFV", _ccffv, value))
                    {
                        int oldValue = _ccffv;
                        _ccffv = value;
                        OnPropertyChanged("CCFFV", oldValue, value);
                    }
                }
            }
        }  private int _ccffv = -1;


        /// <summary>
        /// CCFFP.
        /// </summary>
        public int CCFFP
        {
            get { return _ccffp; }
            set
            {
                if (_ccffp != value)
                {
                    if (OnPropertyChanging("CCFFP", _ccffp, value))
                    {
                        int oldValue = _ccffp;
                        _ccffp = value;
                        OnPropertyChanged("CCFFP", oldValue, value);
                    }
                }
            }
        }  private int _ccffp = -1;


        /// <summary>
        /// CCFFPR.
        /// </summary>
        public int CCFFPR
        {
            get { return _ccffpr; }
            set
            {
                if (_ccffpr != value)
                {
                    if (OnPropertyChanging("CCFFPR", _ccffpr, value))
                    {
                        int oldValue = _ccffpr;
                        _ccffpr = value;
                        OnPropertyChanged("CCFFPR", oldValue, value);
                    }
                }
            }
        }  private int _ccffpr = -1;



        /// <summary>
        /// CCFFCQ.
        /// </summary>
        public int CCFFCQ
        {
            get { return _ccffcq; }
            set
            {
                if (_ccffcq != value)
                {
                    if (OnPropertyChanging("CCFFCQ", _ccffcq, value))
                    {
                        int oldValue = _ccffcq;
                        _ccffcq = value;
                        OnPropertyChanged("CCFFCQ", oldValue, value);
                    }
                }
            }
        }  private int _ccffcq = -1;


        /// <summary>
        /// CCFFJC.
        /// </summary>
        public int CCFFJC
        {
            get { return _ccffjc; }
            set
            {
                if (_ccffjc != value)
                {
                    if (OnPropertyChanging("CCFFJC", _ccffjc, value))
                    {
                        int oldValue = _ccffjc;
                        _ccffjc = value;
                        OnPropertyChanged("CCFFJC", oldValue, value);
                    }
                }
            }
        }  private int _ccffjc = -1;


        /// <summary>
        /// CCFFAB.
        /// </summary>
        public int CCFFAB
        {
            get { return _ccffab; }
            set
            {
                if (_ccffab != value)
                {
                    if (OnPropertyChanging("CCFFAB", _ccffab, value))
                    {
                        int oldValue = _ccffab;
                        _ccffab = value;
                        OnPropertyChanged("CCFFAB", oldValue, value);
                    }
                }
            }
        }  private int _ccffab = -1;


        /// <summary>
        /// CCFComment.
        /// </summary>
        public string CCFComment
        {
            get { return _ccfComment; }
            set
            {
                if (_ccfComment != value)
                {
                    if (OnPropertyChanging("CCFComment", _ccfComment, value))
                    {
                        string oldValue = _ccfComment;
                        _ccfComment = value;
                        OnPropertyChanged("CCFComment", oldValue, value);
                    }
                }
            }
        }  private string _ccfComment = null;


        /// <summary>
        /// IsBuyerRequestedtoResolveDispute
        /// </summary>
        public bool IsBuyerRequestedtoResolveDispute
        {
            get { return _isBuyerRequestedtoResolveDispute; }
            set
            {
                if (_isBuyerRequestedtoResolveDispute != value)
                {
                    if (OnPropertyChanging("IsBuyerRequestedtoResolveDispute", _isBuyerRequestedtoResolveDispute, value))
                    {
                        bool oldValue = _isBuyerRequestedtoResolveDispute;
                        _isBuyerRequestedtoResolveDispute = value;
                        OnPropertyChanged("IsBuyerRequestedtoResolveDispute", oldValue, value);
                    }
                }
            }
        }  private bool _isBuyerRequestedtoResolveDispute = false;

        /// <summary>
        /// IsContractorRequestedtoResolveDispute
        /// </summary>
        public bool IsContractorRequestedtoResolveDispute
        {
            get { return _isContractorRequestedtoResolveDispute; }
            set
            {
                if (_isContractorRequestedtoResolveDispute != value)
                {
                    if (OnPropertyChanging("IsContractorRequestedtoResolveDispute", _isContractorRequestedtoResolveDispute, value))
                    {
                        bool oldValue = _isContractorRequestedtoResolveDispute;
                        _isContractorRequestedtoResolveDispute = value;
                        OnPropertyChanged("IsContractorRequestedtoResolveDispute", oldValue, value);
                    }
                }
            }
        }  private bool _isContractorRequestedtoResolveDispute = false;


        /// <summary>
        /// RequesttoResolveDisputeComment.
        /// </summary>
        public string RequesttoResolveDisputeComment
        {
            get { return _requesttoResolveDisputeComment; }
            set
            {
                if (_requesttoResolveDisputeComment != value)
                {
                    if (OnPropertyChanging("RequesttoResolveDisputeComment", _requesttoResolveDisputeComment, value))
                    {
                        string oldValue = _requesttoResolveDisputeComment;
                        _requesttoResolveDisputeComment = value;
                        OnPropertyChanged("RequesttoResolveDisputeComment", oldValue, value);
                    }
                }
            }
        }  private string _requesttoResolveDisputeComment = null;


        /// <summary>
        /// RequesttoResolveDisputeFeedback.
        /// </summary>
        public string RequesttoResolveDisputeFeedback
        {
            get { return _requesttoResolveDisputeFeedback; }
            set
            {
                if (_requesttoResolveDisputeFeedback != value)
                {
                    if (OnPropertyChanging("RequesttoResolveDisputeFeedback", _requesttoResolveDisputeFeedback, value))
                    {
                        string oldValue = _requesttoResolveDisputeFeedback;
                        _requesttoResolveDisputeFeedback = value;
                        OnPropertyChanged("RequesttoResolveDisputeFeedback", oldValue, value);
                    }
                }
            }
        }  private string _requesttoResolveDisputeFeedback = null;

        #endregion

        #endregion

        #region Public Methods

        #region CreateNew

        /// <summary>
        /// Creates a new, empty Contracts object.
        /// </summary>
        public static Contracts CreateNew()
        {
            Contracts obj = new Contracts();

            // Switch state to Added prior to initializing property values.
            obj.ObjState = ObjectState.Added;

            obj.StartingDate = DateTime.Now;
            return (obj);
        }


        [MethodImpl(MethodImplOptions.Synchronized)]
        public static Contracts CreateNew(ContractsCollection collection)
        {
            Contracts obj = CreateNew();

            collection.Add(obj);

            return (obj);
        }

        #endregion

        #region GetAllContracts

        /// <summary>
        /// Returns a collection of Contracts.
        /// </summary>
        public static ContractsCollection GetAllContracts()
        {
            ContractsTableAdapter adapter = new ContractsTableAdapter();
            adapter.Connection = AppSettings.GetDbConn();

            dsContracts.ContractsDataTable tbl = adapter.GetData(null);

            ContractsCollection list = new ContractsCollection();

            if (tbl.Rows.Count > 0)
            {
                foreach (dsContracts.ContractsRow row in tbl.Rows)
                {
                    Contracts contract = new Contracts();
                    RelationalToObject(contract, row);
                    list.Add(contract);
                }
            }

            return (list);
        }

        #endregion

        #region GetContractByContracID

        /// <summary>
        /// Returns a collection of Contracts.
        /// </summary>
        public static Contracts GetContractsByContractID(string Contractid)
        {
            ContractsTableAdapter adapter = new ContractsTableAdapter();
            adapter.Connection = AppSettings.GetDbConn();

            dsContracts.ContractsDataTable tbl = adapter.GetData(Contractid);

            if (tbl.Rows.Count == 1)
            {
                Contracts contract = new Contracts();
                RelationalToObject(contract, tbl.Rows[0]);
                return (contract);
            }
            else if (tbl.Rows.Count > 1)
                throw new ApplicationException("Database integrity error: Specified 'contract' returned more than one User record.");

            return (null);
        }

        #endregion

        #region GetContractsByJobID

        /// <summary>
        /// Returns a collection of Contracts.
        /// </summary>
        public static Contracts GetContractsByJobID(string jobid)
        {
            ContractsTableAdapter adapter = new ContractsTableAdapter();
            adapter.Connection = AppSettings.GetDbConn();

            dsContracts.ContractsDataTable tbl = adapter.GetDataByJobID(jobid);

            if (tbl.Rows.Count == 1)
            {
                Contracts contract = new Contracts();
                RelationalToObject(contract, tbl.Rows[0]);
                return (contract);
            }
            else if (tbl.Rows.Count > 1)
                throw new ApplicationException("Database integrity error: Specified 'contract' returned more than one User record.");

            return (null);
        }

        #endregion

        #region GetContractsByBidID

        /// <summary>
        /// Returns a collection of Contracts.
        /// </summary>
        public static Contracts GetContractsByBidID(int bidid)
        {
            ContractsTableAdapter adapter = new ContractsTableAdapter();
            adapter.Connection = AppSettings.GetDbConn();

            dsContracts.ContractsDataTable tbl = adapter.GetDataByBidID(bidid);

            if (tbl.Rows.Count == 1)
            {
                Contracts contract = new Contracts();
                RelationalToObject(contract, tbl.Rows[0]);
                return (contract);
            }
            else if (tbl.Rows.Count > 1)
                throw new ApplicationException("Database integrity error: Specified 'contract' returned more than one User record.");

            return (null);
        }

        #endregion

        #region Update

        /// <summary>
        /// Updates the specified Contracts.
        /// </summary>
        public static void Update(Contracts obj)
        {
            bool updateContracts = false;

            // Do not update invalid objects.
            if (!obj.Validate())
            {
                StringBuilder sb = new StringBuilder(2048);
                sb.Append("The object being updated has one or more invalid properties; the Update() operation for this object has been cancelled.\nError(s):");
                foreach (ValidationError err in obj.Errors)
                    sb.Append("\n* " + err.Element + ": " + err.Message);

                throw new InvalidObjectException(sb.ToString());
            }
            else
            {
                updateContracts = (obj.ObjState != ObjectState.Unchanged);

                if (!updateContracts)
                    return;
            }

            ObjectState originalObjectState = obj.ObjState;

            dsContracts.ContractsDataTable tbl = null;
            if (updateContracts)
            {
                ContractsTableAdapter adapter = new ContractsTableAdapter();
                adapter.Connection = AppSettings.GetDbConn();


                tbl = new dsContracts.ContractsDataTable();
                dsContracts.ContractsRow row = tbl.NewContractsRow();
                ObjectToRelational(obj, tbl, row);

                adapter.Update(tbl);

                if (originalObjectState == ObjectState.Deleted)
                    obj = null;
                else RelationalToObject(obj, tbl.Rows[0]);
            }
        }

        #endregion

        #region Validate

        /// <summary>
        /// Validates the object based on its properties at the time of the call; updates the Errors property.
        /// </summary>
        public override bool Validate()
        {
            Errors.Clear();

            if (ObjState == ObjectState.Unchanged)
            {
                // By definition, unchanged objects are valid.
                return (true);
            }
            else if (ObjState == ObjectState.Uninitialized)
            {
                Errors.Add(new ValidationError("object", "Object is uninitialized.", ValidationError.Severity.Error));

                // No need to proceed past this error.
                return (false);
            }
            else if ((ObjState == ObjectState.Deleted))
            {
                // Deleted items must have 'real' (i.e. non-negative, non-zero) key(s) to be valid.
                Errors.Add(new ValidationError("ContractsID", "Deleted object has an invalid PKID.", ValidationError.Severity.Error));

                // No need to proceed past this error.
                return (false);
            }
            else  // ObjState == Added | Modified
            {

            }

            return (Errors.Count == 0);
        }

        #endregion

        #region ToString

        /// <summary>
        /// User-friendly string represetation of this object.
        /// </summary>
        public override string ToString()
        {
            return (String.Format("Contracts: ContractID={0}, JobID={1}, {2}", ContractID, JobID, BidID));
        }

        #endregion

        #endregion

        #region Privates


        #endregion

    }

    /// <summary>
    /// Collection of 0 or more Contracts objects.
    /// </summary>

    public class ContractsCollection : List<Contracts>
    {
        #region Types

        public class UserComparer : IComparer<Contracts>
        {
            public int Compare(Contracts c1, Contracts c2)
            {
                return (String.Compare(c1.ContractID, c2.ContractID));
            }
        }

        #endregion

        #region Public Methods

        #region FindByJobID

        public Contracts FindByJobID(string JobID)
        {
            for (int ndx = 0; ndx < this.Count; ndx++)
                if (this[ndx].JobID == JobID)
                    return (this[ndx]);

            return (null);
        }

        #endregion

        #region FindByBidID

        public Contracts FindByBidID(int BidID)
        {
            for (int ndx = 0; ndx < this.Count; ndx++)
                if (this[ndx].BidID == BidID)
                    return (this[ndx]);

            return (null);
        }

        #endregion

        #endregion

    }
}
